package com.ke.jun.view

import android.animation.ObjectAnimator
import android.animation.ValueAnimator
import android.annotation.SuppressLint
import android.os.Bundle
import android.view.animation.DecelerateInterpolator
import androidx.appcompat.app.AppCompatActivity
import androidx.vectordrawable.graphics.drawable.ArgbEvaluator
import com.ke.jun.view.widght.AnimaView
import com.ke.jun.view.widght.RunningView

class AnateActivity : AppCompatActivity() {
    @SuppressLint("RestrictedApi")
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_anate)
//        var imageView = findViewById<ImageView>(R.id.icon)
//        var animate = imageView.animate()
//        animate.setListener(object :Animator.AnimatorListener{
//            override fun onAnimationStart(animation: Animator?) {
//
//            }
//
//            override fun onAnimationEnd(animation: Animator?) {
//            }
//
//            override fun onAnimationCancel(animation: Animator?) {
//            }
//
//            override fun onAnimationRepeat(animation: Animator?) {
//            }
//
//        })


//    }
//        val interPath= Path()
//        interPath.lineTo(0.25f,0.25f)
//        interPath.moveTo(0.25f,1.5f)
//        interPath.lineTo(1f,1f)
//       ObjectAnimator.ofFloat(imageView,"translationX",500F)
//           .apply {
//               interpolator= PathInterpolator(interPath)
//               repeatCount=10
//
//               start()
//           }

//      val  icons= findViewById<AnimaView>(R.id.icons)
//        val animator = ObjectAnimator.ofInt(icons, "color", -0x10000, -0xff0100)
//        animator.setEvaluator(ArgbEvaluator())
//        animator.start()

        var runningView = findViewById<RunningView>(R.id.runningView)
        ObjectAnimator.ofFloat(0f,3000f).apply {
               duration=3000
              interpolator= DecelerateInterpolator()
               addUpdateListener {
                   var curent = it.animatedValue as Float
                   runningView.stpet=(curent/3000f)*1400
               }

        }.start()

    }
}